==========================
=Armour HUD, by DoomFruit=
==========================

Version 3.0.

Requirements: Minecraft r1.6.4, Minecraft Forge (built against 9.11.1.965, could possibly use any version for r1.6.4?)

Works well with: IndustrialCraft 2 (and the Gravisuite addon), Thermal Expansion (and its Simply Jetpacks addon) and Universal Electricity.


-----------


Description: This mod displays on your HUD the remaining durability level of your currently equipped armour pieces and tool if you have one equipped, or stack size and name if you don't.

If you have IndustrialCraft 2 installed, it will detect the charge level of your tools with much more precision than the coloured status bar does and display that instead. It will also read the fill level or charge status of utility armour, such as batpacks and jetpacks.

This information is given as EU remaining/EU capacity or durability remaining/durability capacity (such as for vanilla tools or the jetpack), colour coded according to its remaining health (there is a config option to make it use percentages instead, should you desire; precision is to a tenth of a percent).

Jetpacks from IC2, the Gravitation Suite addon for IC2 and the Simply Jetpacks addon for Thermal Expansion will also show the state (hover/normal) alongside the item charge. IC2 nanosabres will show their current state (on/off).


By default, the armour HUD appears in the top-right of the screen. This mod will generate a config file in the .minecraft/config/ directory called ArmourHUD.cfg, where you can change the position of the HUD. It contains precisely one property: 0 = top-left, 1 = top-right, 2 = bottom-left, 3 = bottom-right. You can change the position in-game by pressing Insert (this key can be re-bound in the options menu) and the changes will be kept in the config file.


-----------


Installation: copy the Armour_HUD_vx.x.zip file into your .minecraft/mods/ directory and run Minecraft as normal.


-----------


There is also an API for modders to display their own choice of text on the status display. Implement the IArmourHUDProperties.java interface in your item.


-----------


Configuration options:

The mod will create an ArmourHUD.cfg file in your .minecraft/config/ directory. In there are several options:

General category:


HUD Background Opacity = 0-100. Controls how opaque the background for the text and graphics is. 0 = transparent, 100 = completely opaque. Default = 50.

HUD Colour Saturation = 0-100. Controls the colour of the text - set to 0 if you want it white, set to 100 for full colour-coding, set to somewhere in between (integers only) to choose how saturated the text colour is. Default = 70.

HUD Graphics Opacity = 0-100. Controls how opaque the graphical schematic is. 0 = transparent, 100 = opaque. Default = 60.

HUD Graphics Size Percentage = 0-150. Allows you to scale up or scale down the size of the graphical overlay. Default = 60 (version 2.0 screenshots look like that), images for version 2.1 screenshots have it set to 80.

HUD Maximum Hue = 1-360. Controls the hue for full-health items, which is then scaled smoothly along with the item health/charge level. 1 is (nearly) pure red, 120 is pure green, 240 is pure blue, 360 is past violet and back to pure red again. Default = 240.

HUD Position = 0-4. Picks where the HUD gets displayed. 0 = top-left, 1 = top-right, 2 = bottom-left, 3 = bottom-right, 4 = disabled. Default = 1.

HUD Text Opacity = 1-100. Controls how opaque the text is. 0 = transparent, 100 = opaque. Default = 90.

HUD Text Size Percentage = 0-150. Chooses the scaling for the HUD text, where 100 is the size of ordinary Minecraft text. Default = 50.

Show HUD Schematic = true/false. Selects whether to display or hide the graphical schematic. Default = false.

Show HUD Text = true/false. Selects whether to display or hide the text status. Default = true.

Use Percentages instead of exact values = true/false. If you don't like the exact values given when wearing a quantum helmet, you can make it display percentages (accurate to 0.1%) instead. Default = false.


Abbreviations category:

This will be empty at first, but will fill up each time you hold an item in your hand or wear it as armour. It allows you to pick aliases for item names. Format:
(tooltip name)=(display name)

You can use this to create your own abbreviations (eg. QuantumSuit Helmet=QSuit Hat) for more compact text. I haven't distributed any defaults here, since there are so many items to handle and so many different ways of choosing a shorter name. If someone wants to make a config file or list of entries and post it here, go right ahead.


-----------


Changelog:

v1.0 = initial release, showed armour and tool status in the top-right of the screen.

v1.1 = allowed you to change the position of the status, added a config file.

v1.1a = fixed a derpy little bug caused by not paying attention to where my copying and pasting went. Status elements which are not in the top-right corner will now be displayed properly. Thanks to Legamir for making me put in a config option and spotting this bug.

v2.0 = altered code such that without an advanced helmet on (read: something with a visor and circuits, like the nanosuit or quantumsuit helmet), you get a basic listing of your equipped items, with durability on the armour accurate to 10%. With an advanced helmet on, you get a graphical indicator of your equipped stuff with smoothly varying colours from blue to red to indicate the durability, going black when it's completely depleted.

Version 2.1: the graphical schematic may now be disabled by users, the colour saturation of the text may be changed, the text and graphical schematic sizes may now be scaled and you can put in your own names for items (either shortening them or making them more whimsical).

v2.1a = added a check to stop Forge's horrible config file parser code from throwing a wobbly if it hit a character in the item name which isn't alphanumeric or space.

v2.1b = stopped the schematic from showing up when it shouldn't, added an option to disable the status text, made the width behave properly when using OptiFine + texture pack with its own fonts (it'll still use the default font, though), made the hotkey behave a little better (it still won't save, though), altered the default settings for the size and colour saturation.

v2.2 = Added Gravitation Suite integration, changed the display precision with no helmet on to from 10% to 1% and added a config option for the hue of full-health items. Also conducted a pretty large overhaul of the internal workings (there are now 4 separate categories for the text display: prefix, name, value and postfix, each of which can be altered and coloured separately) - almost completely useless to the user (it's to make future expansion/active mod integration easier) except for the fact that the item name is now in white and the charge/damage status is coloured separately.

v2.2c = Fixed array out of bounds exception when using non-damageable armour (such as pumpkins or solar helmets).

v2.2d = Fixed crashing when an item doesn't have a name (FINALLY).

v2.2e = No longer crashes on items that have characters which aren't ASCII. You get question marks instead, but it'll still display and it won't try to write to the config file. Graphical schematic is no longer displayed by default - enable it in the config file if you want it.

v2.2f = You can now make the quantum suit helmet display percentages instead of exact values using a line in the config file.

v2.3 = Mindless recompile under Minecraft r1.3.2 (who'd have thought that the Modloader functions I use are still compatible...), altered GraviSuite integration code slightly for compatibility purposes and for reduced dependency on header files, altered IC2 helmet detection code to reduce the dependency on header files.

v2.3a = Figured out how to alter a config file entry in-game, so the HUD position is now saved after you move it around in-game. FruitDisplayLib was altered to use direct GL calls instead of going through Tessellator.class, so you should no longer get triangles instead of rectangles. For those who access the FruitDisplayLib class or some of the variables in mod_ArmourHUD, some of the functions have been changed to take floats (and variables changed from double to float in mod_ArmourHUD) to reduce the amount of typecasting. Finally, the config file code no longer calls deprecated functions (a step along the way to a 1.4 port).

v2.4 = Ported to MC r1.4.2 (required changes: instead of calling [itemstack].getItemNameandInformation().get(0), now call [itemstack].getItemName()), not tested due to the lack of 1.4 on this particular machine...

v2.4a = Ported to MC r1.4.6 (required changes: a whole lot of includes due to Minecraft's classes being split into a whole bunch of subpackages, item name function has now changed from ItemStack.getItemName() to ItemStack.getDisplayName()) and moved the mod into its own package. If you use FruitDisplayLib for anything, it's now in fruitmods.fruitlibs.

v2.5 = Ported to MC r1.5.1 (required changes: some stuff about isDebugInfoEnabled, alterations to the IElectricItem in IC2's API), added the beginnings of being able to run this mod without IC2 or its API installed.


v3.0 (2014-07-29):
-Ported to MC r1.6.4.
-Added Thermal Expansion and Universal Electricity integration.
-IC2 now shows jetpack and nanosabre status.
-Gravisuite now shows jetpack status.
-Unicode support added (it won't save Unicode names to the config file, though).
-API for modder-defined display text and colours added.

v3.0a (2014-08-05):
-Now automatically cleans formatting code symbols out from item names. You no longer have to see those ugly S-things.
-Attempted to make it compatible with Tinkers' Construct tools, but that failed dismally. At least they don't show up as IC2 tools with zero energy and zero max energy now...


-----------


Credits:

The initial inspiration came from Shockah's Tooltip mod. The text positioning code was originally based on his, but grew far beyond its humble beginnings.


-----------


Source/Compilation Notes:

To compile, prepare a Minecraft Forge'd MCP setup, then extract the IC2, Thermal Expansion and Universal Electricity APIs as normal into the src/minecraft/ directory and put the fruitmods directory alongside it.

Version 3.0 was built against Forge 9.11.1.965.


-----------


Usage:

Do whatever you like with this mod and its source - distribute it, stick it in a modpack, learn from it, carve it into pieces and stick in your own code, whatever. All I ask is that you don't distribute modified versions using the same class names and locations (so that we don't end up with conflicts if someone installs mine and your version).


2014-07-29, DoomFruit. v3.0.
